<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Visits extends Model
{
    use HasFactory;
    use SoftDeletes;
    protected  $guarded = [];
    protected $table = 'visit';

    public function user()
    {
        return $this->hasOne(User::class,'id','user_id');
    }

    public static function getVisit($where = [])
    {
        return self::when($where,function ($query) use ($where){
            return $query->where($where);
        })->get();
    }
}
